import  pymysql
try:
    connect=pymysql.connect(host="127.0.0.1",
                          user="root",
                          password="admin",
                          db="spider",
                          charset="utf8"    )
    curses=connect.cursor()
    sql="insert into teacherinfo(tno,tname,remark) values('123','何凤','安徽第一拿图鲁')"
    curses.execute(sql)
    connect.commit()
except Exception as err:
    connect .rollback()
    print(err)
finally:
    curses.close()
    connect.close
